import _ajax from './request'
function articlesTechnic (params) {
  return _ajax({
    url: '/articles/technic',
    params
  })
}
function chartDataHot () {
  return _ajax({
    url: '/chart-data/hot'
  })
}
function articlesShare (params) {
  // if (typeof _cancel === 'function') {
  //   _cancel()
  // }
  return _ajax({
    url: '/articles/share',
    params
    // cancelToken: new axios.CancelToken(cancel => {
    //   _cancel = cancel
    // })
  })
}
// 面经热搜
function articlesShareTopSearch () {
  return _ajax({
    url: '/articles/shareTopSearch'
  })
}
// 面经详情
function articlesShareId (id) {
  return _ajax({
    url: '/articles/share/' + id
  })
}
// 面经评论
function articlesCommentsId (id, params) {
  return _ajax({
    url: '/articles/comments/' + id,
    params
  })
}
// 发表评论
function articlesComments (data) {
  return _ajax({
    url: '/articles/comments',
    needToken: true,
    method: 'post',
    data
  })
}
export { articlesTechnic, chartDataHot, articlesShare, articlesShareTopSearch, articlesShareId, articlesCommentsId, articlesComments }
